var t = getApp();

Page({
    data: {
        language: "",
        thumb: "",
        name: "",
        total: "",
        sure: "",
        hotel_id: 0,
        title: ""
    },
    onLoad: function(t) {
        t.title && (this.setData({
            title: decodeURIComponent(t.title)
        }), wx.setNavigationBarTitle({
            title: this.data.title
        })), this.checkrouter(), this.getData();
    },
    checkrouter: function() {
        for (var t = wx.getStorageSync("yz_basic_info"), e = t.popularize_page.mini.vue_route, a = 0; a < e.length; a++) if ("HotelManage" == e[a]) return console.log(t.popularize_page.mini.mini_url + "跳转的路径"), 
        void wx.showToast({
            title: "未开启推广权限",
            duration: 1e3,
            icon: "none",
            success: function() {
                setTimeout(function() {
                    wx.redirectTo({
                        url: t.popularize_page.mini.mini_url
                    });
                }, 1e3);
            }
        });
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    onShareTimeline: function() {},
    getData: function() {
        var e = this, a = "";
        a = "收银台" == this.data.title ? "plugin.hotel.frontend.cashier.center.index" : "plugin.hotel.frontend.hotel.center.index";
        var o = t.getNetAddresss(a);
        t._getNetWork({
            url: o,
            success: function(t) {
                var a = t.data;
                if (1 == a.result) {
                    var o = [ a.data.hotel.thumb, a.data.hotel.name, a.data.income.money_total, a.data.income.sure_withdraw_money ], n = o[0], i = o[1], r = o[2], l = o[3];
                    e.setData({
                        thumb: n,
                        name: i,
                        total: r,
                        sure: l
                    }), e.data.hotel_id = a.data.hotel.hotel_id;
                }
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    gotoRecharge: function() {
        wx.navigateTo({
            url: "/packageA/member/withdrawal/withdrawal"
        });
    },
    gotoOrder: function() {
        "收银台" == this.data.title ? wx.navigateTo({
            url: "/packageA/member/myOrder_v2/myOrder_v2?status=0&orderType=hotelcashier"
        }) : wx.navigateTo({
            url: "/packageA/member/myOrder_v2/myOrder_v2?status=0&orderType=hotel_center"
        });
    },
    gotoStat: function() {
        wx.navigateTo({
            url: "/packageC/cashier/cashier_stat/cashier_stat?hotel_id=" + this.data.hotel_id + "&tag=hotel"
        });
    },
    gotoRecord: function() {
        wx.navigateTo({
            url: "/packageA/member/presentationRecord_v2/presentationRecord_v2?type=hotel"
        });
    },
    gotoCode: function() {
        wx.navigateTo({
            url: "/packageC/cashier/cashier_qr/cashier_qr?hotel_id=" + this.data.hotel_id + "&tag=hotel"
        });
    }
});